<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<title>寻物信息</title>
	</head>
	<body>
	</body><!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>失物信息</title>
		<!--注意加载顺序 先加载jQuery的js，在引入bootstrap的-->
		<script type="text/javascript" src="../js/jquery.js"></script>
		<script src="../js/jquery.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="../js/bootstrap.js"></script>
		<script type="text/javascript" src="../js/Finding.js"></script>
		<link rel="stylesheet" href="../css/bootstrap.css" />
		<link rel="stylesheet" href="../css/bootstrap.min.css" />
		<link rel="stylesheet" href="../css/main.css" />
		<script type="text/javascript" src="../js/login.js"></script>
	</head>

	<body>
		<!--
			标题和图片轮播
		-->
		<div class="container">
			<div class="title row">
				<div class="col-md-12">
					<ol class="titlecontent breadcrumb">
						<li>
							<a href="#">徐州工程学院失物招领平台</a>
						</li>
						<li class="active">寻物信息</li>
						<a href="Register.jsp" id="register" class="login dropdown-toggle">注册 </a>
						<a href="#" id="login" class="login dropdown-toggle" data-toggle="modal" data-target="#loginmodal" style="margin-right: 20px;">登录 </b></a>

					</ol>
				</div>
				<div class="col-md-12">
					<div id="myCarousel" class="carousel slide" data-ride="carousel">
						<!-- 轮播（Carousel）指标 -->
						<ol class="carousel-indicators">
							<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
							<li data-target="#myCarousel" data-slide-to="1"></li>
							<li data-target="#myCarousel" data-slide-to="2"></li>
						</ol>
						<!-- 轮播（Carousel）项目 -->
						<div class="carousel-inner">
							<div class="item active">
								<img src="../img/1.jpg" alt="中心校区">
							</div>
							<div class="item">
								<img src="../img/2.jpg" alt="中心校区北门">
							</div>
							<div class="item">
								<img src="../img/3.jpg" alt="图书馆">
							</div>
						</div>
						<!-- 轮播（Carousel）导航 -->
						<a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;
						</a>
						<a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;
						</a>
					</div>
				</div>

				<!--
            	作者：1462859532@qq.com
            	时间：2017-03-28
            	描述：导航条
           -->
				<div class="col-md-12">
					<nav class="navbar navbar-default">
						<div class="container-fluid">
							<div class="navbar-header">
								<a class="navbar-brand active" href="main.jsp"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>主页</a>
							</div>
							<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
								<ul class="nav navbar-nav">
									<li class="#">
										<a href="Losing.jsp"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>失物信息</a>
									</li>
									<li class="active">
										<a href="#"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>寻物信息</a>
									</li>
									<li class="">
										<a href="Guidence.jsp"><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>使用指南</a>
									</li>
									
								</ul>
							</div>
						</div>
					</nav>
				</div>
				<!--失物信息-->
				<div class="col-md-12">
					<div class="panel-heading">
						<div style>主页-> 寻物信息页面 </div>
						<div id="losingpanel">
							<select class="form-control" id="categotyappend">
								<option value="0">--请选择你的物品类型--</option>
								
							</select>
						</div>
					</div>
					<div class="panel panel-default">
						<div class="panel-body">
							<table class="losingtable table table-striped" cellpadding="20px" cellspacing="5" id="losingshow">
								<thead>
									<tr class="active">
										<th>类型</th>
										<th>地点</th>
										<th>发布时间</th>
										<th>描述</th>
										<th>详情</th>
									</tr>
								</thead>
								<tbody id="findingitem">
									
									
								</tbody>
							</table>
						</div>

						<div class="panel-footer">
							<div id="pagerole">
								<nav aria-label="Page navigation">
									<ul class="pagination">
								<li id="findingpagevalue" style="display: none"></li>
								<li id="findingpagecount" style="display: none"></li>
								<li><a href="#" id="itemfirst">首页</a></li>
								<li><a href="#" id="itemprev">上一页</a></li>
								<li><a href="#" id="itemnext">下一页</a></li>
								<li><a href="#" id="itemlast">尾页</a></li>
							</ul>
								</nav>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!--
				固定在窗口的
			-->
			<div class="active" id="declare">
				<ul>
					<li class="active">
						<a href="DeatilItem.jsp"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>我要发帖</a>
					</li>
					<li class="">
						<a href="#"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>联系我们</a>
					</li>
				</ul>
			</div>
			<div class="container-fluid" style="text-align: center;">
				丁鑫版权所有@copyright
			</div>
			
			<!--
        	作者：1462859532@qq.com
        	时间：2017-03-28
        	描述：登录模态框
        -->
		<div class="modal fade" id="loginmodal" tabindex="-1" role="dialog">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">招领平台登录</h4>
					</div>
					<div class="modal-body">
						<div  role="form">
							<div class="form-group">
								<!--
                                	作者：1462859532@qq.com
                                	时间：2017-03-28
                                	描述：可以在上面做个表单验证
                                -->
								<label for="inputEmail3" class="control-label">用户名</label>
								<input type="text" name="UserId" id="input" class="form-control" value="" required="required" pattern="" title="" placeholder="用户名">
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="control-label">用户密码</label>
								<input type="password" name="password" class="form-control" id="password" placeholder="密码">
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<div style="float: left;">
							<a href="#" id="register" class="login dropdown-toggle"  >忘记密码？ </a>
						</div>
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="button" class="btn btn-primary" id="btnsubmit">登录</button>
					</div>
				</div>
				<!--模态框关闭-->
				<script type="text/javascript">
				     $(function(){
				    	 $.ajax({
				    		 type:"post",
				    		 url:"../user/allcategory.action",
				    		 dataType:"json",
				    		 success:function(data){
				    			 for(var i=0;i<data.length;i++){
				    				 $("#categotyappend").append("<option value="+data[i].categoryID+">"+data[i].categoryName+"</option>");
				    			 }
				    			
				    		 }
				    	 });
				    	 
				    	 $.ajax({
				    		  type:"get",
				    		  url:"../user/querypicking.action",
				    		  dataType:"json",
				    		  success:function(data){
				    			  if(data.pickInfo.length>=5){
				    				  length=5;
				    			  }else{
				    				  length=data.pickInfo.length;
				    			  }
				    			  for(var i=0;i<length;i++){
				    				  if(data.pickInfo[i].itemlocation==null){
				    					  data.pickInfo[i].itemlocation="无";
				    				  }
				    				  if(data.pickInfo[i].itemsDescription==null){
				    					  data.pickInfo[i].itemsDescription="无";
				    				  }
				    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
				    						  data.pickInfo[i].pickingID+'</td><td>'+
				    						  data.pickInfo[i].categoryName+'</td><td>'+
				    						  data.pickInfo[i].itemlocation+'</td><td>'+
				    						  data.pickInfo[i].pickerTime+'</td><td>'+
				    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
				    				  $("#findingpagevalue").text(data.currentpage);
				    			  }
				    			  $("#findingpagecount").text(data.count);
				    		  }
				    	  });
				     });
				     
				     $("#itemfirst").click(function(){
				    	 var categotyappend=$("#categotyappend").find("option:selected").val();
				    	  $.ajax({
				    		  type:"get",
				    		  url:"../user/querypicking.action?currentpage=0",
				    		  dataType:"json",
				    		  data:{"categoryID":categotyappend},
				    		  success:function(data){
				    			  $("#findingitem tr").remove();
				    			  var length;
				    			  if(data.pickInfo.length>=5){
				    				  length=5;
				    			  }else{
				    				  length=data.pickInfo.length;
				    			  }
				    			  for(var i=0;i<length;i++){
				    				  if(data.pickInfo[i].itemlocation==null){
				    					  data.pickInfo[i].itemlocation="无";
				    				  }
				    				  if(data.pickInfo[i].itemsDescription==null){
				    					  data.pickInfo[i].itemsDescription="无";
				    				  }
				    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
				    						  data.pickInfo[i].pickingID+'</td><td>'+
				    						  data.pickInfo[i].categoryName+'</td><td>'+
				    						  data.pickInfo[i].itemlocation+'</td><td>'+
				    						  data.pickInfo[i].pickerTime+'</td><td>'+
				    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
				    				  $("#findingpagevalue").text(data.currentpage);
				    			  }
				    			  $("#findingpagecount").text(data.count);
				    		  }
				    	  });
				      });
				      
				      $("#itemprev").click(function(){
				    	  var categotyappend=$("#categotyappend").find("option:selected").val();
				    	  var pagecurrent=$("#findingpagevalue").text();
			    		  //总页数
			    		  var pagecount=$("#findingpagecount").text();
			    		  if(parseInt(pagecurrent)==0){
			    			  alert("不好意思，已经是第一页了");
			    		  }else{
			    			  $.ajax({
			    				  type:"get",
					    		  url:"../user/querypicking.action?currentpage="+(parseInt(pagecurrent)-1),
					    		  dataType:"json",
					    		  data:{"categoryID":categotyappend},
					    		  success:function(data){
					    			  $("#findingitem tr").remove();
					    			  var length;
					    			  if(data.pickInfo.length>=5){
					    				  length=5;
					    			  }else{
					    				  length=data.pickInfo.length;
					    			  }
					    			  for(var i=0;i<length;i++){
					    				  if(data.pickInfo[i].itemlocation==null){
					    					  data.pickInfo[i].itemlocation="无";
					    				  }
					    				  if(data.pickInfo[i].itemsDescription==null){
					    					  data.pickInfo[i].itemsDescription="无";
					    				  }
					    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
					    						  data.pickInfo[i].pickingID+'</td><td>'+
					    						  data.pickInfo[i].categoryName+'</td><td>'+
					    						  data.pickInfo[i].itemlocation+'</td><td>'+
					    						  data.pickInfo[i].pickerTime+'</td><td>'+
					    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
					    				  $("#findingpagevalue").text(data.currentpage);
					    			  }
					    			  $("#findingpagecount").text(data.count);
					    		  }
					    	  });
			    		  }
				    	 
				      });
				      
				      $("#itemnext").click(function(){
				    	  var categotyappend=$("#categotyappend").find("option:selected").val();
				    	  //当前页
			    		  var pagecurrent=$("#findingpagevalue").text();
				    	  //alert(pagecurrent);
			    		  //总页数
			    		  var pagecount=$("#findingpagecount").text();
			    		  //alert(pagecount);
			    		  if((parseInt(pagecurrent)+1)*5>=pagecount){
			    			  alert("不好意思，已经是最后一页了");
			    		  }else{
			    			  $.ajax({
			    				  type:"get",
					    		  url:"../user/querypicking.action?currentpage="+(parseInt(pagecurrent)+1),
					    		  dataType:"json",
					    		  data:{"categoryID":categotyappend},
					    		  success:function(data){
					    			  $("#findingitem tr").remove();
					    			  if(data.pickInfo.length>=5){
					    				  length=5;
					    			  }else{
					    				  length=data.pickInfo.length;
					    			  }
					    			  for(var i=0;i<length;i++){
					    				  if(data.pickInfo[i].itemlocation==null){
					    					  data.pickInfo[i].itemlocation="无";
					    				  }
					    				  if(data.pickInfo[i].itemsDescription==null){
					    					  data.pickInfo[i].itemsDescription="无";
					    				  }
					    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
					    						  data.pickInfo[i].pickingID+'</td><td>'+
					    						  data.pickInfo[i].categoryName+'</td><td>'+
					    						  data.pickInfo[i].itemlocation+'</td><td>'+
					    						  data.pickInfo[i].pickerTime+'</td><td>'+
					    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
					    				  $("#findingpagevalue").text(data.currentpage);
					    			  }
					    			  $("#findingpagecount").text(data.count);
					    		  }
			    			  });
			    		  }
				      });
				      
				      $("#itemlast").click(function(){
				    	  var categotyappend=$("#categotyappend").find("option:selected").val();
				    	  var last;
			    		  if(parseInt($("#findingpagecount").text())%5!=0){
			    			  last=parseInt(parseInt($("#findingpagecount").text())/5);
			    		  }else{
			    			  last=parseInt($("#findingpagecount").text())/5-1;
			    		  }
			    		  $.ajax({
		    				  type:"get",
				    		  url:"../user/querypicking.action?currentpage="+last,
				    		  dataType:"json",
				    		  data:{"categoryID":categotyappend},
				    		  success:function(data){
				    			  $("#findingitem tr").remove();
				    			  if(data.pickInfo.length>=5){
				    				  length=5;
				    			  }else{
				    				  length=data.pickInfo.length;
				    			  }
				    			  for(var i=0;i<length;i++){
				    				  if(data.pickInfo[i].itemlocation==null){
				    					  data.pickInfo[i].itemlocation="无";
				    				  }
				    				  if(data.pickInfo[i].itemsDescription==null){
				    					  data.pickInfo[i].itemsDescription="无";
				    				  }
				    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
				    						  data.pickInfo[i].pickingID+'</td><td>'+
				    						  data.pickInfo[i].categoryName+'</td><td>'+
				    						  data.pickInfo[i].itemlocation+'</td><td>'+
				    						  data.pickInfo[i].pickerTime+'</td><td>'+
				    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
				    				  $("#findingpagevalue").text(data.currentpage);
				    			  }
				    			  $("#findingpagecount").text(data.count);
				    		  }
		    			  })
				      });
				      
				      $("#categotyappend").change(function(){
					    	var categotyappend=$("#categotyappend").find("option:selected").val();
					    	$.ajax({
					    		  type:"get",
					    		  url:"../user/querypicking.action",
					    		  data:{"categoryID":categotyappend},
					    		  dataType:"json",
					    		  success:function(data){
					    			  $("#findingitem tr").remove();
					    			  if(data.pickInfo.length>=5){
					    				  length=5;
					    			  }else{
					    				  length=data.pickInfo.length;
					    			  }
					    			  for(var i=0;i<length;i++){
					    				  if(data.pickInfo[i].itemlocation==null){
					    					  data.pickInfo[i].itemlocation="无";
					    				  }
					    				  if(data.pickInfo[i].itemsDescription==null){
					    					  data.pickInfo[i].itemsDescription="无";
					    				  }
					    				  $("#findingitem").append('<tr onclick="losinghelp(this)"><td style="display: none;">'+
					    						  data.pickInfo[i].pickingID+'</td><td>'+
					    						  data.pickInfo[i].categoryName+'</td><td>'+
					    						  data.pickInfo[i].itemlocation+'</td><td>'+
					    						  data.pickInfo[i].pickerTime+'</td><td>'+
					    						  data.pickInfo[i].itemsDescription+'</td><td>查看详情</td>');
					    				  $("#findingpagevalue").text(data.currentpage);
					    			  }
					    			  $("#findingpagecount").text(data.count);
					    		  }
					    	  });
					    });
				      function losinghelp(e){
				    	  //alert($(e).children(":first").text());
				    	  var id=$(e).children(":first").text();
				    	  var categotyappend=$("#categotyappend").find("option:selected").val();
				    	  window.open("../user/ItemInfo.jsp?id="+id+"&type=1");
				      }
				</script>

	</body>

</html>
</html>